package com.kede.api.order.utils;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;

/***
 ** @Author:Pr.li
 ** @Description: 接入apispace
 * 官网  https://www.apispace.com/console/visitControll/?orgId=28485
 ** @Date: create in 2023/5/13 11:02
 ***/
    public class LogisOrderAPiUtils {

    private static final String token = "djkxus56hya0xmosoglvgiipi1uwte0j";


    public static String getLogisInfo(String cpCode ,String mailNo){
        String url = "https://eolink.o.apispace.com/wlgj1/paidtobuy_api/trace_search";
        HttpRequest post = HttpUtil.createPost(url);
        JSONObject jsonObject = new JSONObject();
        jsonObject.putOpt("cpCode",cpCode);
        jsonObject.putOpt("mailNo",mailNo);
        post.body(jsonObject.toString());
        post.contentType("application/json");
        post.header("X-APISpace-Token",token);
        post.header("Authorization-Type","apikey");
        HttpResponse execute = post.execute();
        execute.charset("utf-8");
        String s = execute.body();
        return s;
    }


    public static void main(String[] args) {
        String yunda = getLogisInfo("YUNDA", "433220751534023");
        System.out.println(yunda);
    }


}
